<template>
    <div class="navbar">
        <van-nav-bar title="我的订单" left-arrow @click-left="$router.go(-1)" />
    </div>
    <div>
        <van-card v-for="(item, index) in orders" :num="item.num" :price="item.originprice" :desc="item.proname"
            :thumb="item.img1">
            <template #footer>
                <van-button size="small" @click="cmon(item)">评论</van-button>
            </template>
        </van-card>

    </div>
    <div class="btbox">
        没有更多啦快去选购吧~~~
    </div>
</template>

<script setup lang="ts">
import { Orderlist } from '@/api/api'
import { ref, onMounted } from 'vue';
import { useUserInfoStore } from '@/stores/useInfo';
import { useRouter } from 'vue-router';

const router = useRouter()
const orders = ref<any[]>([])
const store = useUserInfoStore()
const userid = store.getUserId
const getlist = async () => {
    const res = await Orderlist({ userid: userid })
    if (res.data.code === '200') {
        orders.value = res.data.data
    }
}
const cmon = (item: any) => {
    router.push({
        path: '/commonon',
        query: {
            proid: item.proid
        }
    })
}
onMounted(() => {
    getlist()
})
</script>

<style lang="scss" scoped>
.btbox {
    height: 30px;
    line-height: 30px;
    text-align: center;
}
</style>